using System;
using System.Runtime;
using System.Reflection;

namespace GeoFramework
{
#if !PocketPC || DesignTime
#if Framework20
    [Obfuscation(Feature = "renaming", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "controlflow", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "stringencryption", Exclude = false, ApplyToMembers = true)]
#endif
#endif
	public sealed class CancelableEventArgs : EventArgs
	{
		private bool pCanceled;		

		public CancelableEventArgs(bool isCanceled)
		{
			pCanceled = isCanceled;
		}

        /// <summary>
        /// Controls whether an operation is to be aborted.
        /// </summary>
        /// <remarks>This property, when set to True will signal that a pending operation should not execute.  For example,
        /// an event which is raised immediately before connecting would check this property to determine whether to 
        /// continue connecting, or exit.</remarks>
		public bool Canceled
		{
			get
			{
				return pCanceled;
			}
            set
            {
                pCanceled = value;
            }
		}
	}

#if !PocketPC || DesignTime
#if Framework20
    [Obfuscation(Feature = "renaming", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "controlflow", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "stringencryption", Exclude = false, ApplyToMembers = true)]
#endif
#endif
	public sealed class TimeSpanEventArgs : EventArgs
	{
		private TimeSpan pTimeSpan;

		public static new readonly TimeSpanEventArgs Empty = new TimeSpanEventArgs(TimeSpan.Zero);

		/// <summary>
		/// Creates a new instance containing the specified TimeSpan object.
		/// </summary>
		/// <param name="timeSpan">A <strong>TimeSpan</strong> object describing a length of time.</param>
		/// <remarks></remarks>
		/// <seealso cref="TimeSpan">TimeSpan Property</seealso>
		/// <seealso cref="System.TimeSpan">TimeSpan Structure</seealso>
		public TimeSpanEventArgs(TimeSpan timeSpan)
		{
			pTimeSpan = timeSpan;
		}

		/// <summary>
		/// Indicates a length of time which is the target of the event.
		/// </summary>
		/// <value>A <strong>TimeSpan</strong> object describing a length of time.</value>
		/// <remarks></remarks>
		/// <seealso cref="System.TimeSpan">TimeSpan Structure</seealso>
		public TimeSpan TimeSpan
		{
			get
			{
				return pTimeSpan;
			}
		}
	}

	/// <summary>
	/// Represents information about a byte array when a byte array-related event is
	/// raised.
	/// </summary>
	/// <remarks>This class is used for events which use a byte array as a parameter.</remarks>
	/// <example>
	///     This example demonstrates how to use <strong>ByteArrayEventArgs</strong> when
	///     raising an event.
	///     <code lang="VB" title="[New Example]">
	/// ' Declare a new event
	/// Dim MyByteArrayEvent As ByteArrayEventHandler
	///  
	/// Sub Main()
	///     ' Create a byte array
	///     Dim MyArray As New Byte(50);
	///     ' Raise our custom Event
	///     RaiseEvent MyByteArrayEvent(Me, New ByteArrayEventArgs(MyByteArray));
	/// End Sub
	///     </code>
	/// 	<code lang="CS" title="[New Example]">
	/// // Declare a new event
	/// ByteArrayEventHandler MyByteArrayEvent;
	///  
	/// void Main()
	/// {
	///     // Create a byte array
	///     byte[] MyByteArray = new byte(90);
	///     // Raise our custom event
	///     if(MyByteArrayEvent != null)
	///         MyByteArrayEvent(this, new ByteArrayEventArgs(MyByteArray));
	/// }
	///     </code>
	/// </example>
#if !PocketPC || DesignTime
#if Framework20
    [Obfuscation(Feature = "renaming", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "controlflow", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "stringencryption", Exclude = false, ApplyToMembers = true)]
#endif
#endif
	public sealed class ByteArrayEventArgs : EventArgs
	{

		private byte[] pBytes;

		public ByteArrayEventArgs(byte[] bytes)
		{
			pBytes = bytes;
		}

		public byte[] Bytes
		{
			get
			{
				return pBytes;
			}
		}
	}

#if !PocketPC || DesignTime
#if Framework20
    [Obfuscation(Feature = "renaming", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "controlflow", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "stringencryption", Exclude = false, ApplyToMembers = true)]
#endif
#endif
	public sealed class ArrayEventArgs : EventArgs
	{

		private Array oArray;

		public static new readonly ArrayEventArgs Empty = new ArrayEventArgs(null);

		public ArrayEventArgs(Array array)
		{
			oArray = array;
		}

		public Array Array
		{
			get
			{
				return oArray;
			}
		}
	}

	/// <summary>
	/// Represents information about the date and time reported by the GPS device.
	/// </summary>
#if !PocketPC || DesignTime
#if Framework20
    [Obfuscation(Feature = "renaming", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "controlflow", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "stringencryption", Exclude = false, ApplyToMembers = true)]
#endif
#endif
	public sealed class DateTimeEventArgs : EventArgs
	{
		private DateTime dDateTime;

		/// <summary>
		/// Creates a new instance.
		/// </summary>
		/// <param name="dateTime">A DateTime object containing a date and time reported by the GPS device.</param>
		public DateTimeEventArgs(System.DateTime dateTime)
		{
			dDateTime = dateTime;
		}

		/// <summary>
		/// A date and time value in UTC time (not adjusted for the local time zone).
		/// </summary>
		/// <value>A DateTime object containing a date and time reported by the GPS device.</value>
		/// <remarks>This date and time value is not adjusted to the local time zone.  Use the 
		/// <see cref="System.DateTime.ToLocalTime">ToLocalTime</see> method to adjust to local time.</remarks>
		/// <seealso cref="System.DateTime">DateTime Class</seealso>
		/// <seealso cref="System.DateTime.ToLocalTime">ToLocalTime Method (DateTime Class)</seealso>
		public System.DateTime DateTime
		{
			get
			{
				return dDateTime;
			}
		}
	}

	/// <summary>
	/// Represents information about an exception when an error-related event is raised.
	/// </summary>
	/// <remarks>This object is used throughout the GPS.NET framework to provide notification when
	/// either of two situations occur:
	/// 
	/// <list>
	/// <item>An exception is thrown which cannot be trapped via a Try..Catch block (such as from a separate thread)</item>
	/// <item>An exception is thrown which can be recovered from and should not halt the current operation.</item>
	/// </list>
	/// Most frequently, this class is used when a parsing exception occurs via the Parse method or during automatic
	/// data collection.</remarks>
	/// <example>This example demonstrates how to use this class when raising an event.
	/// <code lang="VB">
	/// ' Create a new exception
	/// Dim MyException As New ApplicationException("The error was successfully created.")
	/// ' Declare a new event
	/// Dim MyErrorEvent As ExceptionEventHandler
	/// 
	/// Sub Main()
	///   ' Raise our custom event
	///   RaiseEvent MyErrorEvent(Me, New ExceptionEventArgs(MyException))
	/// End Sub
	/// </code>
	/// <code lang="C#">
	/// // Create a new exception
	/// ApplicationException MyException = new ApplicationException("The error was successfully created.")
	/// // Declare a new event
	/// ExceptionEventHandler MyErrorEvent;
	/// 
	/// void Main()
	/// {
	///   // Raise our custom event
	///   MySatelliteEvent(this, New ExceptionEventArgs(MyException));
	/// }
	/// </code>
	/// </example>
#if !PocketPC || DesignTime
#if Framework20
    [Obfuscation(Feature = "renaming", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "controlflow", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "stringencryption", Exclude = false, ApplyToMembers = true)]
#endif
#endif
	public class ExceptionEventArgs : EventArgs
	{
		private Exception oException;

		/// <summary>
		/// Creates a new instance containing the specified exception object.
		/// </summary>
		/// <param name="exception">An <strong>Exception</strong> object or derivitive describing the error.</param>
		public ExceptionEventArgs(Exception exception)
		{
			oException = exception;
		}

		/// <summary>
		/// Indicates information about the error and its location within a module.
		/// </summary>
		/// <value>An <strong>ApplicationException</strong> object or derivitive describing the error.</value>
		public Exception Exception
		{
			get
			{
				return oException;
			}
		}
	}

#if !PocketPC || DesignTime
#if Framework20
    [Obfuscation(Feature = "renaming", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "controlflow", Exclude = true, ApplyToMembers = true)]
    [Obfuscation(Feature = "stringencryption", Exclude = false, ApplyToMembers = true)]
#endif
#endif
	public class ProgressEventArgs : EventArgs
    {
        private int pCurrent;
        private int pTotal;

        public new static readonly ProgressEventArgs Empty = new ProgressEventArgs(0, 0);

        public ProgressEventArgs(int total)
        {
            pTotal = total;
        }

        public ProgressEventArgs(int current, int total)
        {
            pCurrent = current;
            pTotal = total;
        }

        public int Total
        {
            get
            {
                return pTotal;
            }
        }

        public int Current
        {
            get
            {
                return pCurrent;
            }
        }
    }

}